{extend name='common:base'}
{block name="content"}
<form class="form-horizontal" id="form" method="post" action="" enctype="multipart/form-data">
    <div class="form-group">
        <label for="inputEmail3" class="col-sm-2 control-label">组名称</label>
        <div class="col-sm-10">
            <input type="text" name="title" class="form-control" data-rule-required="true" data-msg-required="必须输入" id="inputEmail3" placeholder="请输入规则名称">
        </div>
    </div>
    <div class="form-group">
        <label for="" class="col-sm-2 control-label">状态</label>
        <div class="col-sm-10">
            <label class="radio-inline">
                <input type="radio" name="status"  value="1" checked> 启用
            </label>
            <label class="radio-inline">
                <input type="radio" name="status"  value="0"> 禁用
            </label>
        </div>
    </div>
    <!--该处为目录树-->
    <div class="form-group">
        <label  class="col-sm-2 control-label">权限管理</label>
        <div class="col-sm-10">
            {volist name='rules' id='vo'}
            <div class="panel panel-default">
                <div class="panel-heading"><label class="checkbox-inline"><input type="checkbox"  name="rules[]" value="{$vo.rid}">{$vo.title}</label></div>
                <div class="panel-body">
                    {volist name='vo._data' id='v'}
                    <label class="checkbox-inline">
                        <input type="checkbox" name="rules[]"  value="{$v.rid}" pid="{$vo.rid}"> {$v.title}
                    </label>
                    {/volist}
                </div>
            </div>
            {/volist}
        </div>
    </div>
    <input type="hidden" name="__token__" value="{$Request.token}">
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" class="btn btn-default">提交</button>
        <button type="reset" class="btn btn-default">取消</button>
    </div>
    </div>

</form>

{/block}

{block name="extend_js"}
<script src="/bower/jquery-validation/dist/jquery.validate.js"></script>
<script src="/bower/jquery-validation/src/localization/messages_zh.js"></script>
<script>
    $().ready(function(){
        $("#form").validate();
        $("input[type='checkbox']").click(function(){
            var check=$(this).prop('checked');
            var pid=$(this).prop('value');
            $("input[pid="+pid+"]").prop('checked',check);
        });
    });

</script>
{/block}